<template>
  <view class="notice">
    <fui-tabs center  :tabs="tabs" @change="change"></fui-tabs>
    <NoticeCar :name="tabs[defIndex]" :item="item" v-for="item in dataList" :key="item.id" />
  </view>
</template>

<script setup lang="ts">
 import NoticeCar from "./components/NoticeCar.vue";
 import dyNoticeService from "@/api/dyNoticeService";
 import type { IListByTypeRes } from "@/api/model/dyNoticeModel";
 const  tabs = ref(['系统公告', '系统通知'])
 const defIndex = ref(0)
 const dataList = ref<Array<IListByTypeRes>>()
 const listByType = async ()=>{
  const {success,result} =  await dyNoticeService.listByType({type:defIndex.value})
  if(success){
    dataList.value =  result
  }
 }
 const change = (e:any)=>{
  defIndex.value = e.index
  listByType()
 }
 onLoad(()=>{
  listByType()
 })
 
</script>

<style lang="scss" scoped>
page{
    background-color: rgb(248,248,248);
}
.notice{
    padding: 28rpx;
    background-color: rgb(248,248,248);
}
</style>
